package com.example.whopxx.domain;

import java.util.HashMap;
import java.util.Map;

public class RegFormBean {
    private String username;
    private String password;
    private String repassword;

    private String truename;

    private String gender;

    private String phone;

    private String email;

    private String cardNo;

    private String card;

    private Map<String, String> errors = new HashMap<>();

    public Map<String, String> getErrors() {
        return errors;
    }

    public void setErrors(Map<String, String> errors) {
        this.errors = errors;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRepassword() {
        return repassword;
    }

    public void setRepassword(String repassword) {
        this.repassword = repassword;
    }

    public String getTruename() {
        return truename;
    }

    public void setTruename(String truename) {
        this.truename = truename;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public String getCard() {
        return card;
    }

    public void setCard(String card) {
        this.card = card;
    }

    public boolean validate() {

        boolean flag = true;

        if (password != null && !password.equals(repassword)) {
            errors.put("repassword", "两次输入的密码不匹配.");
            flag = false;
        }
        if (username==null||username.isEmpty())
        {
            errors.put("username","用户名不能为空！！！");
            flag = false;
        }

        return  flag;
    }
}
